<?php
/*========================================= JooSam =========================================/
/																							/
/	Extention:		JooSam																	/
/	Created by:		ScriptPlanet.eu															/
/	Site:			http://www.scriptplanet.eu												/
/	Email:			support@scriptplanet.eu													/
/	Support:		http://www.scriptplanet.eu/support										/
/	Copyright:		2011 (c) ScriptPlanet.eu												/
/	License:		CC BY-NC-ND 3.0 ~ http://creativecommons.org/licenses/by-nc-nd/3.0/		/
/	File Version:	0001																	/
/																							/
/========================================== JooSam ========================================*/
// Joomla security
defined('_JEXEC') or die;

## Import Joomla Data
jimport('joomla.application.component.view'); 

class JooSamViewEvents extends JView{

	function display($tpl = null){

		## Get Data
        $items = $this->get('Items');
		$pagination = $this->get('Pagination');
		
		## Check Error
		if (count($errors = $this->get('Errors'))) {
			JError::raiseError(500, implode('<br />', $errors));
			return false;
		}

		## Links
		$this->items = $items;
		$this->pagination = $pagination;
		
		## Set toolbar & Document
		$this->addToolBar();
		$this->setDocument();
        
		## Display
		parent::display($tpl);
	}


	## Toolbar
    protected function addToolBar(){

		$canDo	= JoosamHelper::getActions();
		JToolBarHelper::title(JText::_('COM_JOOSAM_VIEW_EVENTS_TITLEBAR'), 'event-title-logo');
		
		if ($canDo->get('core.create')){
			JToolBarHelper::addNew('event.add'); }
		if ($canDo->get('core.edit')){
			JToolBarHelper::editList('event.edit'); }
		if ($canDo->get('core.delete')){
			JToolBarHelper::deleteList('', 'events.delete'); }
	}

	## Document
	protected function setDocument(){

		$document = JFactory::getDocument();
		$document->setTitle(JText::_('COM_JOOSAM_VIEW_EVENTS_TITLE'));
		
		$document->addStyleDeclaration('.icon-48-event-title-logo{
											background-image:url(../media/com_joosam/images/event.Title.Logo.png);
											background-position:10px 1px;
										}
										.jsamLegend{
											border-radius:10px;
										}
										.inputbox {
											float:right !important;
											margin:0 0 0 5px !important;
											padding0 !important;
										}
										.limit{
											line-height:18px !important;
										}
		');
	}		
}
?>